﻿using System.Text;

namespace Sharp.Portal.AdminLTE.FormField
{
    /// <summary>
    /// 图片字段
    /// </summary>
    public class ImageField : ElementField
    {
        /// <summary>
        /// 图片字段
        /// </summary>
        /// <param name="fieldName"></param>
        public ImageField(string fieldName)
        {
            this.FieldName = fieldName;
        }
        /// <summary>
        /// 生成
        /// </summary>
        /// <param name="nonFirst"></param>
        /// <returns></returns>
        public override string Build(bool nonFirst = false)
        {
            var sb = new StringBuilder();
            sb.AppendFormat("<img width=\"160\" alt=\"\" class=\"thumbnail img-responsive\" src=\"@Model.{0}\" />", FieldName);
            return sb.ToString();
        }
    }
}
